package com.yang.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Utils {
    public static String md5JiaMi(String pwd) throws NoSuchAlgorithmException {
        String str = null;
        //对在登录页面输入的密码进行加密
        MessageDigest md5 = MessageDigest.getInstance("MD5");
        //md5加密的是字节数组，所以需要数组转为字节
        md5.update(pwd.getBytes());
        //加密
        byte[] digest = md5.digest();
        //将字节数组转为字符数组
        str = new BigInteger(1,digest).toString(16);

        return str;
    }

}
